package com.nxy.dao;

import com.nxy.entity.Reply;

import java.util.List;

public class ReplyDao extends BaseDao<Reply>{
    public int addReply(Reply r){
        String sql = "insert into reply(mid,replyMsg) values(?,?)";
        return update(sql,r.getMid(),r.getReplyMsg());
    }
    public List<Reply> queryReply(){
        String sql = "select * from reply";
        return queryMore(sql,Reply.class);
    }

    public Reply queryReplyByRid(String id){
        String sql = "select * from reply where id = ?";
        return queryOne(sql,Reply.class,id);
    }

    public int deleteReply(String id){
        String sql = "delete from reply where id = ?";
        return update(sql,id);
    }

    public int updateReply(Reply r){
        String sql = "update reply set replyMsg = ? where id = ?";
        return update(sql,r.getReplyMsg(),r.getId());
    }
}
